
<template>
    <basic-container class="noScrollBar tabMain-wrap">
        <avue-crud :option="detailOptions.options" :table-loading="loading" :data="data" :page.sync="page" ref="crud"
            v-model="form" :permission="permissionList" @row-save="rowSave" @row-update="rowUpdate"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
            :upload-after="uploadAfter" @on-load="onLoad">

            <template slot-scope="{ row }" slot="menuLeft">
                <el-button type="danger" icon="el-icon-plus" size="small" @click="rowSaveForm(row)">新增</el-button>
            </template>
            <!-- 注意 父子表时，子表的prop+"Form"=slot才行 -->
            <avue-crud slot="infoZeroForm" :option="info0Option" v-model="info0Form" :data="infoData0">
                <template slot-scope="{ row }" slot="menu">
                    <el-button @click="print(row)" type="text" size="small" icon="el-icon-download">下载附件</el-button>
                    <el-button @click="infoRowDel(row)" v-show="userInfo.user_id == row.createUser" type="text"
                        size="small" icon="el-icon-remove">删除附件</el-button>
                </template>
            </avue-crud>
            <!-- 注意 父子表时，子表的prop+"Form"=slot才行 -->
            <avue-crud slot="infoOneForm" :option="info1Option" v-model="info1Form" :data="infoData1">
                <template slot-scope="{ row }" slot="menu">
                    <el-button @click="print(row)" type="text" size="small" icon="el-icon-download">下载附件</el-button>
                    <el-button @click="infoRowDel(row)" v-show="userInfo.user_id == row.createUser" type="text"
                        size="small" icon="el-icon-remove">删除附件</el-button>
                </template>
            </avue-crud>
            <!-- 注意 父子表时，子表的prop+"Form"=slot才行 -->
            <avue-crud slot="infoTwoForm" :option="info2Option" v-model="info2Form" :data="infoData2">
                <template slot-scope="{ row }" slot="menu">
                    <el-button @click="print(row)" type="text" size="small" icon="el-icon-download">下载附件</el-button>
                    <el-button @click="infoRowDel(row)" v-show="userInfo.user_id == row.createUser" type="text"
                        size="small" icon="el-icon-remove">删除附件</el-button>
                </template>
            </avue-crud>
            <template slot-scope="{ row }" slot="menu">
                <el-button @click="rowViewForm(row)" type="text" size="small" icon="el-icon-view">查看</el-button>
                <el-button @click="rowDel(row)" v-show="userInfo.user_id == row.createUser" type="text" size="small"
                    icon="el-icon-remove">删除</el-button>
                <el-button @click="rowEditForm(row)" v-show="userInfo.user_id == row.createUser" type="text"
                    size="small" icon="el-icon-edit">编辑</el-button>
            </template>
            <avue-form v-model="form" :option="option">
                <template slot="cascaderType" slot-scope="{node,data}">
                    <!-- <el-tooltip placement="top"> -->
                    <span>{{ (data || {}).label }}</span>
                    <span v-if="!node.isLeaf"> ({{((data || {}).children || []).length }}) </span>
                    <!-- </el-tooltip> -->
                </template>
            </avue-form>
        </avue-crud>
        <el-drawer :visible.sync="showAddMenuDrawer" :direction="'ltr'" :title="caseTit" :size="'75%'" :center="false"
            :modal="false" :destroy-on-close="true">
        </el-drawer>
    </basic-container>
</template>
<script>
import { mapGetters } from "vuex";

import { getToken } from '@/util/auth';
import {
    getYqybTzlist,
    yqybTzSave,
    yqybTzUpdate,
    yqybTzRemove,
    yqybTzUpload,
    filePrint,
    filePrintByUrl,
} from "@/api/sxdky/sxdky";
import { mapState, mapMutations } from 'vuex'
export default {
    data() {
        return {
            // 文件预览
            filePrint: filePrint,
            filePrintByUrl: filePrintByUrl,
            form: {},
            info0Form: {},
            info1Form: {},
            info2Form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            selectionList: [],
            data: [],
            infoData0: [],
            infoData1: [],
            infoData2: [],
            detailOptions: {
                label: "仪器仪表台账",
                name: "yqybtz",
                options: {
                    height: "calc(100vh - 425px)",
                    index: true,
                    indexLabel: "序号",
                    indexFixed: false,
                    menuDelBtn: false,
                    menuUpBtn: false,
                    menuDownBtn: true,
                    dialogDirection: "ltr",
                    dialogType: "drawer",
                    calcHeight: 30,
                    excelBtn: true,
                    tip: false,
                    searchShow: true,
                    searchMenuSpan: 6,
                    border: true,
                    menuForm: false,
                    selection: true,
                    dialogClickModal: false,
                    menuOtherBtn: true,
                    gistBtn: false,
                    align: "center",
                    menuAlign: "center",
                    searchIcon: true,
                    searchIndex: 3,
                    labelWidth: 160,
                    addBtn: false,
                    viewBtn: false,
                    editBtn: false,
                    delBtn: false,
                    column: [
                        {
                            label: "设备名称",
                            prop: "name",
                            search: true,
                            display: false,
                            overHidden: true,
                        },
                        {
                            label: "设备分类",
                            prop: 'deviceTypeKey',
                            type: 'select',
                            search: true,
                            display: false,
                            overHidden: true,
                            dicData: [
                                {
                                    label: "实验室仪器",
                                    value: '0',
                                },
                                {
                                    label: "试位机",
                                    value: '1',
                                },
                            ],
                        },
                        {
                            label: "部门",
                            prop: "deptName",
                            search: true,
                            display: false,
                            overHidden: true,
                        },
                        {
                            label: "规格型号",
                            prop: "categoryId",
                            type: "select",
                            search: false,
                            display: false,
                        },
                        {
                            label: "性能状态",
                            prop: "statusKey",
                            type: "dateTime",
                            search: false,
                            display: false,
                            overHidden: true,
                            sortable: false,
                            dicData: [
                                {
                                    label: "运行",
                                    value: '0',
                                },
                                {
                                    label: "报废",
                                    value: '1',
                                },
                            ],
                        },
                        {
                            label: "购置日期",
                            prop: "buyTime",
                            search: false,
                            display: false,
                            overHidden: true,
                            // sortable: true,
                        },
                        {
                            label: "上次校验日期",
                            prop: "lastVerifyTime",
                            type: "dateTime",
                            search: false,
                            display: false,
                            overHidden: true,
                            // sortable: true,
                        },
                        {
                            label: "定检开始日期",
                            prop: "dingjianStartTime",
                            type: "datetime",
                            search: false,
                            display: false,
                            overHidden: true,
                            // sortable: true,
                        },
                        {
                            label: "定检结束日期",
                            prop: "dingjianEndTime",
                            type: "datetime",
                            search: false,
                            display: false,
                            overHidden: true,
                            // sortable: true,
                        },
                        {
                            label: "制造厂家",
                            prop: "manufacturer",
                            search: false,
                            display: false,
                            overHidden: true,
                            sortable: false,
                        },
                        {
                            label: "资产编号",
                            prop: "assetId",
                            search: false,
                            display: false,
                            overHidden: true,
                        },
                        {
                            label: "设备编码",
                            prop: "deviceCode",
                            search: false,
                            display: false,
                            overHidden: true,
                        }
                    ],
                    group: [
                        {
                            label: '基础信息',
                            column: [
                                {
                                    label: "仪器仪表名称",
                                    prop: "name",
                                    search: false,
                                    display: true,
                                    rules: [{
                                        required: true,
                                        message: "请输入仪器仪表名称",
                                        trigger: "blur"
                                    }]
                                },
                                {
                                    label: "部门",
                                    prop: "deptName",
                                    search: false,
                                    display: true,
                                    rules: [{
                                        required: true,
                                        message: "请输入部门",
                                        trigger: "blur"
                                    }]
                                },
                                {
                                    label: "设备分类",
                                    prop: "deviceTypeKey",
                                    type: "select",
                                    search: false,
                                    display: true,
                                    dicData: [
                                        {
                                            label: "实验室仪器",
                                            value: 0,
                                        },
                                        {
                                            label: "试位机",
                                            value: 1,
                                        },
                                    ],
                                },
                                {
                                    label: "性能状态",
                                    prop: "statusKey",
                                    search: false,
                                    display: true,
                                    dicData: [
                                        {
                                            label: "运行",
                                            value: 0,
                                        },
                                        {
                                            label: "报废",
                                            value: 1,
                                        },
                                    ],
                                    rules: [{
                                        required: true,
                                        message: "请输入性能状态",
                                        trigger: "blur"
                                    }]
                                },
                                {
                                    label: "规格型号",
                                    prop: "categoryId",
                                    // type: "select",
                                    search: false,
                                    display: true,
                                },
                                {
                                    label: "购置日期",
                                    prop: "buyTime",
                                    type: "datetime",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "上次校验日期",
                                    prop: "lastVerifyTime",
                                    type: "datetime",
                                    // search: true,
                                    addDisplay: false,
                                    editDisplay: false,
                                    viewDisplay: true,
                                    overHidden: true,
                                    display: true,
                                },
                                {
                                    label: "保管人",
                                    prop: "keeper",
                                    // type: "select",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "设备来源",
                                    prop: "equipResource",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "定检开始日期",
                                    prop: "dingjianStartTime",
                                    type: "datetime",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "定检结束日期",
                                    prop: "dingjianEndTime",
                                    type: "datetime",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "异动信息",
                                    prop: "moveInfo",
                                    search: false,
                                    addDisplay: false,
                                    editDisplay: false,
                                    viewDisplay: true,
                                    overHidden: true,
                                    display: true,
                                }, {
                                    label: "大修信息",
                                    prop: "repairInfo",
                                    search: false,
                                    addDisplay: false,
                                    editDisplay: false,
                                    viewDisplay: true,
                                    overHidden: true,
                                    display: true,
                                }, {
                                    label: "定检信息",
                                    prop: "dingjianInfo",
                                    search: false,
                                    addDisplay: false,
                                    editDisplay: false,
                                    viewDisplay: true,
                                    overHidden: true,
                                    display: true,
                                },
                                {
                                    label: "制造厂家",
                                    prop: "manufacturer",
                                    search: false,
                                    addDisplay: false,
                                    editDisplay: false,
                                    viewDisplay: true,
                                    overHidden: true,
                                    display: true,
                                },
                                {
                                    label: "资产编号",
                                    prop: "assetId",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                },
                                {
                                    label: "设备编码",
                                    prop: "deviceCode",
                                    search: false,
                                    display: true,
                                    overHidden: true,
                                    // type: "cascader",
                                    // typeslot: true,
                                    // dicData: dic
                                    // dicData: [{
                                    //     value: '电网技术中心',
                                    //     label: 'DW',
                                    //     // tip: "电网技术中心",
                                    //     searchTip: '我是一个左边提示语',
                                    //     children: [{
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: '技术监督室',
                                    //             label: '01'
                                    //         }, {
                                    //             value: '状态评价室',
                                    //             label: '02'
                                    //         }]
                                    //     }, {
                                    //         value: '继保及自动化室',
                                    //         label: '02',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     }, {
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     }, {
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     }, {
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     }, {
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     }, {
                                    //         value: '系统技术室',
                                    //         label: '01',
                                    //         children: [{
                                    //             value: 'yizhi',
                                    //             label: '一致'
                                    //         }, {
                                    //             value: 'fankui',
                                    //             label: '反馈'
                                    //         }]
                                    //     },
                                    //     ]
                                    // },
                                    // ]
                                },
                            ]
                        }, {
                            label: '设备照片',
                            viewDisplay: true,
                            column: [{
                                type: "upload",
                                prop: "picUrl",
                                labelWidth: 0,
                                addDisplay: true,
                                editDisplay: true,
                                viewDisplay: true,
                                // showFileList: true,
                                overHidden: true,
                                span: 24,
                                loadText: "模板上传中，请稍等",
                                slot: true,
                                hide: true,
                                accept: ".png,,jpg,.gif",
                                // tip: "请上传标准格式文件",
                                action: '/api/dis-report/file/upload?groupId=yqybtz_pic',
                                // label: "附件上传",
                                // type: "upload",
                                // prop: "upload",
                                // addDisplay: true,
                                // editDisplay: true,
                                // viewDisplay: false,
                                // // showFileList: true,
                                // overHidden: true,
                                // span: 24,
                                // loadText: "模板上传中，请稍等",
                                // slot: true,
                                // hide: true,
                                // accept: ".docx,.doc,.zip",
                                // // tip: "请上传标准格式文件",
                                // action: '/api/dis-report/file/upload?groupId=yqybtz',
                            },
                                {
                                    labelWidth: 0,
                                    label: '',
                                    prop: 'infoZero',
                                    span: 24,
                                    hide: true,
                                    formslot: true,
                                }]
                        },
                        {
                            label: '能力说明',
                            viewDisplay: true,
                            column: [
                                {
                                    // label: "能力说明上传",
                                    type: "upload",
                                    prop: "qualUrl",
                                    labelWidth: 0,
                                    addDisplay: true,
                                    editDisplay: true,
                                    viewDisplay: true,
                                    // showFileList: true,
                                    overHidden: true,
                                    span: 24,
                                    loadText: "模板上传中，请稍等",
                                    slot: true,
                                    hide: true,
                                    accept: ".docx,.doc,.zip",
                                    // tip: "请上传标准格式文件",
                                    action: '/api/dis-report/file/upload?groupId=yqybtz_qual',
                                },
                                {
                                    labelWidth: 0,
                                    label: '',
                                    prop: 'infoOne',
                                    span: 24,
                                    hide: true,
                                    formslot: true,
                                }
                            ]
                        },
                        {
                            label: '说明书',
                            viewDisplay: true,
                            column: [{
                                labelWidth: 0,
                                // label: '',
                                prop: 'detailUrl',
                                // span: 24,
                                // hide: true,
                                formslot: true,
                                label: "",
                                type: "upload",
                                // prop: "upload",
                                addDisplay: true,
                                editDisplay: true,
                                viewDisplay: true,
                                // showFileList: true,
                                overHidden: true,
                                span: 24,
                                loadText: "模板上传中，请稍等",
                                // slot: true,
                                hide: true,
                                accept: ".docx,.doc,.zip",
                                // tip: "请上传标准格式文件",
                                action: '/api/dis-report/file/upload?groupId=yqybtz_detail',
                            },
                            {
                                labelWidth: 0,
                                label: '',
                                prop: 'infoTwo',
                                span: 24,
                                hide: true,
                                formslot: true,
                            }
                            ]
                        },
                    ]
                },
                url: {
                    getList: getYqybTzlist,
                    remove: yqybTzRemove,
                    update: yqybTzUpdate,
                    add: yqybTzSave,
                },
            },
            info0Option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                columnBtn: false,
                column: [{
                    label: '附件名',
                    prop: 'fileName',
                },
                {
                    label: '附件url',
                    prop: 'fileUrl'
                },
                {
                    label: '创建人',
                    prop: 'createUser'
                }]
            },
            info1Option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                columnBtn: false,
                column: [{
                    label: '附件名',
                    prop: 'fileName',
                },
                {
                    label: '附件url',
                    prop: 'fileUrl'
                },
                {
                    label: '创建人',
                    prop: 'createUser'
                }]
            },
            info2Option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                refreshBtn: false,
                columnBtn: false,
                column: [{
                    label: '附件名',
                    prop: 'fileName',
                },
                {
                    label: '附件url',
                    prop: 'fileUrl'
                },
                {
                    label: '创建人',
                    prop: 'createUser'
                }]
            },
        };
    },
    components: {},
    computed: {
        ...mapState(['formData']),
        ...mapGetters(["permission", "userInfo", "formData"]),
        permissionList() {
            return {
                addBtn: this.vaildData(this.permission.dnzl_add, false),
                viewBtn: this.vaildData(this.permission.dnzl_add, false),
                delBtn: this.vaildData(this.permission.dnzl_add, false),
                editBtn: this.vaildData(this.permission.dnzl_add, false),
            };
        },
        ids() {
            let ids = [];
            this.selectionList.forEach((ele) => {
                ids.push(ele.id);
            });
            return ids.join(",");
        },

    },
    mounted() {

    },
    methods: {
        ...mapMutations(['assignFormData']),
        handleChange(value) {
            console.log(value);
        },
        // 点击自定义新增按钮时触发，
        rowSaveForm(row) {
            this.infoData0 = [] //清空暂存区
            this.infoData1 = [] //清空暂存区
            this.infoData2 = [] //清空暂存区
            this.$refs.crud.rowAdd(row);
        },
        // 点击自定义父表单编辑按钮时触发
        rowEditForm(row) {
            this.infoData0 = this.spitFileNameUrl(row.picUrl, row.createUser) //用数据库读取到的新数据来更新暂存区
            this.infoData1 = this.spitFileNameUrl(row.qualUrl, row.createUser) //用数据库读取到的新数据来更新暂存区
            this.infoData2 = this.spitFileNameUrl(row.detailUrl, row.createUser) //用数据库读取到的新数据来更新暂存区
            this.$refs.crud.rowEdit(row);
        },
        // 点击自定义父表单查看按钮触发
        rowViewForm(row) {
            this.infoData0 = this.spitFileNameUrl(row.picUrl, row.createUser)//用数据库读取到的新数据来更新暂存区
            this.infoData1 = this.spitFileNameUrl(row.qualUrl, row.createUser)//用数据库读取到的新数据来更新暂存区
            this.infoData2 = this.spitFileNameUrl(row.detailUrl, row.createUser)//用数据库读取到的新数据来更新暂存区
            this.$refs.crud.rowView(row);//打开查看窗口
        },
        // 点击自定义父表单删除按钮触发
        rowDel(row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return this.detailOptions.url.remove(row.id);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.$refs.crud.toggleSelection();
                });
        },
        // 点击新增-保存按钮时触发
        rowSave(row, done, loading) {
            row.payProof = this.payProof;
            row.picUrl = this.getFileNameUrl(this.infoData0) //把暂存区中数据组装，然后保存到后端
            row.qualUrl = this.getFileNameUrl(this.infoData1) //把暂存区中数据组装，然后保存到后端
            row.detailUrl = this.getFileNameUrl(this.infoData2) //把暂存区中数据组装，然后保存到后端
            this.detailOptions.url.add(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();//done:成功打开则继续下一步，
                },
                (error) => {
                    window.console.log(error);
                    loading();// loading:错误则加载状态
                }
            );
        },
        // 点击编辑-修改按钮时触发
        rowUpdate(row, index, done, loading) {
            row.qualUrl = this.getFileNameUrl(this.infoData0)//把暂存区中数据组装，然后保存到后端
            row.qualUrl = this.getFileNameUrl(this.infoData1)//把暂存区中数据组装，然后保存到后端
            row.detailUrl = this.getFileNameUrl(this.infoData2)//把暂存区中数据组装，然后保存到后端
            console.log(row)
            this.detailOptions.url.update(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        // 点击自定义子表单删除按钮触发
        infoRowDel(row) {
            this.infoData0 = this.infoData0.filter((item) => { //修改暂存区
                if (item.fileUrl != row.fileUrl) {
                    return item
                }
            })
            this.infoData1 = this.infoData1.filter((item) => { //修改暂存区
                if (item.fileUrl != row.fileUrl) {
                    return item
                }
            })
            this.infoData2 = this.infoData2.filter((item) => { //修改暂存区
                if (item.fileUrl != row.fileUrl) {
                    return item
                }
            })
        },
        // 上传回调
        uploadAfter(res, done) {
            if (res.data.type == 'yqybtz_qual') {
                this.infoData1.push({ "fileName": res.data.name, "fileUrl": res.data.url, "createUser": this.userInfo.user_id })  //每次上传都把数据保存到暂存区,每次打开窗口都得先清空暂存区，因此不推荐新增时使用，可以编辑和查看时使用。
            } else if (res.data.type == 'yqybtz_detail') {
                this.infoData2.push({ "fileName": res.data.name, "fileUrl": res.data.url, "createUser": this.userInfo.user_id })
            } else {
                this.infoData0.push({ "fileName": res.data.name, "fileUrl": res.data.url, "createUser": this.userInfo.user_id })
            }
            done();
        },
        // spitFileNameUrl(row) {//把附件的nameUrl给划分成这种形式[{name:xx,url:yy},{},{}]
        //     if (row.nameUrl != "" && row.nameUrl != undefined && row.nameUrl != null && row.nameUrl !== '') {
        //         return row.nameUrl.substr(0, row.nameUrl.length - 1) //删掉最后一个逗号
        //             .split(',')
        //             .map((item) => {
        //                 let result = {}
        //                 result.fileName = item.split(":")[0]
        //                 result.fileUrl = item.split(":")[1]
        //                 result.createUser = row.createUser
        //                 return result
        //             })
        //     } else {
        //         return []
        //     }

        // },
        spitFileNameUrl(nameUrl, createUser) {//把附件的nameUrl给划分成这种形式[{name:xx,url:yy},{},{}]
            if (nameUrl != "" && nameUrl != undefined && nameUrl != null && nameUrl !== '') {
                return nameUrl.substr(0, nameUrl.length - 1) //删掉最后一个逗号
                    .split(',')
                    .map((item) => {
                        let result = {}
                        result.fileName = item.split(":")[0]
                        result.fileUrl = item.split(":")[1]
                        result.createUser = createUser
                        return result
                    })
            } else {
                return []
            }

        },
        getFileNameUrl(infoData) {//把暂存区的[{fileName:xx,fileUrl:yy},{},{}]这种格式的infoData转换成nameUrl
            let result = ""
            if (infoData != [] && infoData != undefined && infoData != null) {
                infoData.forEach((item) => {
                    result = result + item.fileName + ":" + item.fileUrl + ","
                })
            }
            return result
        },
        // getFileNameUrl() {//把暂存区的[{name:xx,url:yy},{},{}]这种格式的infoData转换成nameUrl
        //     let result = ""
        //     if (this.infoData1 != [] && this.infoData1 != undefined && this.infoData1 != null) {
        //         this.infoData1.forEach((item) => {
        //             result = result + item.fileName + ":" + item.fileUrl + ","
        //         })
        //     }
        //     return result
        // },
        // 打印下载
        print(row) {
            // window.open(this.filePrint + `?id=${row.id}&${this.website.tokenHeader}=${getToken()}`);
            window.open(this.filePrintByUrl + `?url=${row.fileUrl}&${this.website.tokenHeader}=${getToken()}`)
        },

        searchReset() {
            this.query = {};
            this.onLoad(this.page);
        },
        searchChange(params, done) {
            this.query = params;
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        selectionChange(list) {
            this.selectionList = list;
        },
        selectionClear() {
            this.selectionList = [];
            this.$refs.crud.toggleSelection();
        },
        listAllDelete() {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据");
                return;
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return this.detailOptions.url.remove(this.ids);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.$refs.crud.toggleSelection();
                });
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        onLoad(page, params = {}) {
            let values = {
                ...params,
            };
            this.loading = true;
            this.detailOptions.url.getList(page.currentPage, page.pageSize, values)
                .then((res) => {
                    const data = res.data.data;
                    this.page.total = data.total;
                    this.data = data.records;
                    this.loading = false;
                    this.selectionClear();
                });
        },
        selInfoChange(list) {
            console.log(list)
        },
        saveMenuData(row) {
            let selArr = [];
            this.selList.forEach(item => {
                selArr.push(item.id)
            })
            let selData = {
                id: row.id,
                ids: selArr.toString()
            }
            this.detailOptions.menuUrl.saveMenu(selData).then(
                () => {
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    this.showAddMenuDrawer = false;
                },
                (error) => {
                    window.console.log(error);
                }
            );
        },
        selMenuChange(list) {
            this.selList = list;
        },
        cancelSignItem(rowData) {
            console.log(rowData)
        },
        cancelSign() {
            console.log(this.selectionList)
        },
    }
};
</script>
<style lang='scss'>
.tabMain-wrap {
    // height: calc(100vh - 400px);
    overflow: hidden auto;
}

.fileConList {
    p {
        margin: 0;
    }

    .scrollDiv {
        height: calc(100% - 90px);
        overflow: auto;
    }
}
</style>
